package ThreadPoolRunnable;

class MyRunnable implements Runnable {
    private int taskNumber;

    public MyRunnable(int taskNumber) {
        this.taskNumber = taskNumber;
    }

    @Override
    public void run() {
        System.out.println("pool-l-thread-" + Thread.currentThread().getId() + " (Start) message = " + taskNumber);
        try {
            Thread.sleep(2000); // 让线程睡眠2秒
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt(); // 重新设置中断状态
            System.out.println("Thread was interrupted.");
        }
        System.out.println("pool-l-thread-" + Thread.currentThread().getId() + " (End)");
    }
}